import framework.Factory;
import framework.Product;
import homework.HomeworkFactory;
import idcard.IDCardFactory;
import log.DatabaseLogFactory;
import log.FileLogFactory;
import log.Log;
import log.LogFactory;

public class Main {
    public static void main(String[] args) {
        // 1. IDCard
        Factory idCardFactory = new IDCardFactory();
        Product card1 = idCardFactory.create("乔峰");
        Product card2 = idCardFactory.create("令狐冲");
        Product card3 = idCardFactory.create("武松");
        card1.use();
        card2.use();
        card3.use();
        // 2. Homework
        Factory homeworkFactory = new HomeworkFactory();
        Product homework1 = homeworkFactory.create("乔峰");
        Product homework2 = homeworkFactory.create("令狐冲");
        Product homework3 = homeworkFactory.create("武松");
        homework1.use();
        homework2.use();
        homework3.use();
        //3. Log
        LogFactory logFactory = new FileLogFactory();
        Log fileLog1 = logFactory.createLog("文件日志内容1");
        Log fileLog2 = logFactory.createLog("文件日志内容2");
        LogFactory databaseLogFactory = new DatabaseLogFactory();
        Log databaseLog1 = databaseLogFactory.createLog("数据库日志内容1");
        Log databaseLog2 = databaseLogFactory.createLog("数据库日志内容2");
        fileLog1.writeLog();
        fileLog2.writeLog();
        databaseLog1.writeLog();
        databaseLog2.writeLog();
    }
}
